<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="vue.js"></script>
</head>
<body>
    <div id="app">
        <my-parent></my-parent>
    </div>
    <template id="father">
        <div>
            父组件
            <my-son :mess="msg" :money="1000" :text="txt"></my-son>
            <my-son></my-son>
        </div>
    </template>

    <template id="son">
        <div>
            子组件 {{ mess }} {{ money }} {{text}}
        </div>
    </template>

    <script>
        const son = {
            //props: [ 'mess', 'money', 'text'],
            props: {
                mess: String,
                money: Number,
                text: String, //warn会爆出类型错误 1234为Number类型
            },
            template: '#son'
        }
        const father = {
            template: '#father',
            data(){
                return {
                    msg: '我是父组件发送子组件的消息',
                    txt: 1234
                }
            },
            components: {
                'mySon': son
            }
        }
        new Vue({
            el: '#app',
            components: {
                'myParent':father
            } 
        })
    </script>
</body>
</html>